<?php

namespace App\Modules\Apicrzs\Http\Controllers\System;

use App\Modules\Apicrzs\Http\Controllers\BaseApicrzsController;
use App\Modules\Apicrzs\Services\System\AgreementService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class PolicyController extends BaseApicrzsController
{

    public function __construct(AgreementService $authService)
    {
        $this->service = $authService;
    }

    public function getAgreementType(Request $request): JsonResponse
    {
        $params = $request->all();
        if ($result = $this->service->getAgreementByType($params)) {
            return $this->sendApiSuccess($result, $this->service->getError());
        }else{
            return $this->sendApiError($this->service->getError());
        }
    }
}
